package com.ydx.meituan.controller;


import com.ydx.meituan.config.annotation.AuthSign;
import com.ydx.meituan.model.Annotations.YdxRequestParams;
import com.ydx.meituan.model.params.TestParams;
import com.ydx.meituan.protocol.NetResult;
import com.ydx.meituan.protocol.ResultUtils;
import com.ydx.meituan.service.beanbox.ServiceBeanBox;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
public class TestController {

    @Resource
    public ServiceBeanBox s;

    @AuthSign
    @GetMapping("/get/form")
    public NetResult<Map> getForm(@Validated TestParams params) throws Exception {
        HashMap<String, Object> map = new HashMap<>();
        map.put("params",params);
        return   ResultUtils.buildResult(map);
    }



    @AuthSign
    @PostMapping("/post/form")
    public NetResult<Map> postForm( @YdxRequestParams  @Validated TestParams params) throws Exception {
        HashMap<String, Object> map = new HashMap<>();
        map.put("params",params);
        return   ResultUtils.buildResult(map);
    }





    @AuthSign
    @PostMapping("/post/json")
    public NetResult<Map> postJson(@Validated @RequestBody TestParams params){
        HashMap<String, Object> map = new HashMap<>();
        map.put("params",params);
        return   ResultUtils.buildResult(map);
    }







}
